<%inherit file="/mtp.html"/>
<%! from mtp.model import Page %>

<h1>Pages tagged with ${" ".join(c.tags)}</h1>

<ul>
    <% lastpage = None %>
    % for tag in c.pages:
        % if lastpage != tag.object_id:
            % if lastpage:
                </ul>
            </li>
            % endif
            <% page = Page.get(tag.object_id) %>
            <li><a href="${h.url_for('page', id=page.urlTitle())}">${page.title}</a>
                <ul>
            <% lastpage = tag.object_id %>
        % endif
            <li>${tag.tag}</li> 
    % endfor
</ul>
